﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using System.Collections.Generic;

public partial class BaseData_NewsType : System.Web.UI.Page
{
    protected void Page_PreInit(object sender, EventArgs e)
    {
        Page.Theme = BLL.Common.GetWSMThemes();
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Bind();
        }
    }
    private void Bind()
    {
        NewTypeListControl1.Bind();
    }
    public void Add()
    {
        if (Check.CheckPermission("300300100", "00001"))
        {
            Response.Redirect("NewsTypeEdit.aspx");
        }
        else
        {
            Share.Alert(this.Page, "无权操作"); return;
        }
    }
    public void Update()
    {
        if (Check.CheckPermission("300300100", "00002"))
        {
            List<int> s = NewTypeListControl1.Selected;
            if (s.Count > 0)
            {
                Response.Redirect("NewsTypeEdit.aspx?code=" + s[0].ToString());
            }
            else
            {                
                Page.RegisterStartupScript("StartUp", "<script language=javascript>alert('请选择一条需要编辑的记录')</script>");                
            }
        }
        else
        {
            Share.Alert(this.Page, "无权操作"); return;
        }
    }
    public void Delete()
    {
        if (Check.CheckPermission("300300100", "00003"))
        {
            List<int> s = NewTypeListControl1.Selected;
            new BLL.NewType().Delete(s);
            Share.InsertLog("300300100", "00003");
            Response.Redirect("NewsType.aspx");
        }
        else
        {
            Share.Alert(this.Page, "无权操作"); return;
        }
    }
}
